package com.gamutsoft.amb.common.email;

import com.gamutsoft.amb.common.util.EnvironmentUtil;

public class SendMailUtil {   
  private static String serverHost =  EnvironmentUtil.getInstance().getPropertyValue("serverHost");
  private static String serverPort =  EnvironmentUtil.getInstance().getPropertyValue("serverPort");  
  private static String serverUserName =  EnvironmentUtil.getInstance().getPropertyValue("serverUserName");  
  private static String serverPwd =  EnvironmentUtil.getInstance().getPropertyValue("serverPwd");  
  private static String sendEmailFrom =  EnvironmentUtil.getInstance().getPropertyValue("sendEmailFrom");
  public static boolean sendMail(String title,String content,String email) {   
      MailInfo mailinfo=new MailInfo();   
      //--设置邮件服务器开始   
      mailinfo.setMailServerHost(serverHost);   
      mailinfo.setMailServerPort(serverPort);   
       mailinfo.setValidate(true);   
       mailinfo.setUserName(serverUserName);   
       mailinfo.setPassword(serverPwd);   
       //--设置邮件服务器结束   
       mailinfo.setFromAddress(sendEmailFrom);//邮件发送者的地址   
       //设置接受用户   
       String []ToAddress={email};   
       mailinfo.setToAddress(ToAddress);   
       //设置附件   
      // String []attach={"F:\\login.properties"};   
      // mailinfo.setAttachFileNames(attach);   
       mailinfo.setSubject(title);   
       mailinfo.setContent(content);//网页内容   
       SendMail sm=new SendMail();   
      return sm.sendHtmlMail(mailinfo);        
   }   
 
  }  
